1. Field of the Invention
The present invention relates to a method and an apparatus for taking, with an image taking device, an image of an object and detecting an edge of the object based on image data representing the taken image.
2. Discussion of Related Art
It is widely practiced to detect a shape, a dimension, and/or a position of an object, by lighting a rear or back surface of the object and taking a silhouette image thereof. In addition, it is also practiced to light a front surface of an object and take an image of the front surface (hereinafter, referred to as xe2x80x9cthe front-surface imagexe2x80x9d) of the object.
The above-mentioned silhouette-image taking method requires that a lighting device be provided in rear of the object. Thus, the degree of freedom of the image taking device is low. In addition, only an outermost shape of the object can be obtained, although in some cases other features of the object may be needed. Meanwhile, the above-mentioned front-surface-image taking method may suffer a problem that an edge of the front-surface image is unclear and accordingly a shape, a dimension, or a position of the object cannot be detected with high accuracy.
The present invention provides an edge detecting method and an edge detecting apparatus which have the following features. Those features are described, like claims, in respective paragraphs which are given respective numbers. Any feature that includes another feature shall do so by referring to the number given to the latter feature. However, the following features and the appropriate combinations thereof are just examples to which the technical features, and the combinations thereof, described in the specification are by no means limited. In addition, in the case where one feature recites a plurality of items, it is not essentially required that all of those items be simultaneously employed. That is, it is possible to select and employ only a portion (one, two, . . . , but not all) of those items.
(1) According to a first feature of the present invention, there is provided a method of detecting an edge of an object, comprising the steps of lighting, in each one of a plurality of different directions, at least a portion of the object, taking an image of the portion of the object and a vicinity of the portion which are lighted in the each one of the different directions, synthesizing the respective images of the portion of the object taken by lighting the portion in the different directions, and detecting, based on the synthesized images, an edge of the portion of the object.
Between a front-surface image of an object and an image of a portion of a vicinity of the object that is not lighted by a testing light, that is, an image of a shadowed portion of the vicinity, there is usually a significant difference in optical characteristic (e.g., luminance or hue). Therefore, if the front-surface image of the object and the image of the shadowed portion of the vicinity are simultaneously taken, it is possible to accurately detect, by lighting the front surface of the object and taking the front-surface image of the object, a portion of an edge of the object that corresponds to the shadowed portion of the vicinity (i.e., a portion of the edge that defines a bound between the object and the shadowed portion). However, to this end, it is needed to light the object in a direction inclined relative to a normal of an object""s surface whose edge is to be detected, and accordingly only a portion of the vicinity of the object located on one side of the object"" surface is shadowed. Hence, in the present embodiment, an object is lighted in each selected one of a plurality of different directions, an image of the object and the shadowed portion of the vicinity in that state is taken, and the respective images taken by lighting the object in the different directions are synthesized. Thus, an edge of a predetermined portion of the object can be detected. For example, in the case where an object""s surface whose edge is to be detected is a rectangular surface, when the object is lighted in each one of two directions which are, in a plane which contains one of two diagonal lines of the rectangular surface and is perpendicular to the surface, inclined with respect to the one diagonal line such that the two directions have respective components each of which is parallel to the one diagonal line and which are opposite to each other, an entire edge of the rectangular surface that correspond to the four sides of the rectangle can be detected. In addition, in the case where a front surface of an object has at least one step, each image of the object and the vicinity thereof may include a plurality of edges. In the latter case, too, any one of those edges of the object can be entirely detected by selecting appropriate directions in each of which the object is lighted.
(2) According to a second feature of the present invention that includes the first feature (1), the detecting step comprises detecting an entire edge of a surface of the object.
It is preferred that the above-indicated surface of the object be a plane surface. However, the above subject may be a moderate convex or concave surface. That is, the above subject may be any surface which is bounded by a clear edge.
(3) According to a third feature of the present invention that includes the second feature (2), the surface is a rectangular surface, the different directions comprise two first directions which are, in a plane which contains one of two diagonal lines of the rectangular surface and is perpendicular to the surface, inclined with respect to the one diagonal line such that the two first directions have respective components each of which is parallel to the one diagonal line and which are opposite to each other, or two second directions which are near to the two first directions, respectively, and the taking step comprises taking an image of the portion of the object and a vicinity of the portion which are lighted in each one of the first or second directions.
It is preferred that the lighting directions in each of which the object is lighted be the two first directions contained in the plane perpendicular to the rectangular surface. However, the lighting directions may be the two second directions which are inclined by respective small angles relative to that plane.
(4) According to a fourth feature of the present invention that includes any one of the first to third features (1) to (3), the object comprises an electric component.
An image of an electric component may be taken in a state in which the component is supported on a support surface (the support surface preferably has a dark color, such as blue, brown, or black), or otherwise in a state in which the component is sucked and held by an end of a suction nozzle. In the latter case, it is preferred to provide the suction nozzle with a back plate having a dark surface defining a background of the component held by the nozzle.
(5) According to a fifth feature of the present invention, there is provided an apparatus for detecting an edge of an object, comprising a plurality of lighting devices each one of which lights, in a corresponding one of a plurality of different directions, at least a portion of the object; an image taking device which takes an image of the portion of the object and a vicinity of the portion which are lighted by the each one of the lighting devices in the one of the different directions; a control device which controls the lighting devices and the image taking device such that the each one of the lighting devices lights the portion of the object in the one of the different directions and the image taking device takes the image of the portion of the object and the vicinity of the portion lighted by the each one lighting device in the one direction; and an image-data processing device which processes a plurality of batches of image data representing the respective images taken by the image taking device from the portion of the object lighted by the each one of the lighting devices in the one of the different directions, and detects an edge of the portion of the object.
The present edge detecting apparatus can advantageously perform the edge detecting method according to the first feature (1). Since the control device automatically controls the selection of each of the lighting devices and the image taking operations of the image taking device, a plurality of images of the object and the vanity can be taken easily and quickly. In addition, since the image-data processing device automatically detects, based on the taken images, an edge of the object, the edge can be detected quickly and accurately.
(6) According to a sixth feature of the present invention that includes the fifth feature (5), the edge detecting apparatus further comprises an object holder which holds the object, the lighting devices are provided around the object holder such that the lighting devices are equiangularly spaced from each other about the object holder, and the image-data processing device detects an entire edge of a surface of the object held by the object holder.
(7) According to a seventh feature of the present invention that includes the sixth feature (6), the lighting devices are provided on a part-spherical concave surface whose center is located on a centerline of the object holder.
Since the plurality of lighting devices are provided on the part-spherical concave surface, not only an azimuth angle but also an elevation angle of each direction in which the object is lighted can be changed by selecting an appropriate one or more of the lighting devices. Therefore, in the case where the front surface of the object has at least one step, an edge of a surface of any step of the object can be easily detected.
(8) According to an eighth feature of the present invention that includes the sixth or seventh feature (6) or (7), the object holder comprises a holding head including a suction nozzle which sucks and holds the object, and a back plate which has a dark surface providing a dark background of the suction nozzle.
(9) According to a ninth feature of the present invention that includes any one of the sixth to eighth features (6) to (8), the object holder comprises a support member having a support surface which supports a lower portion of the object.
Since the object is supported by the support surface of the support member, a shadow of the object is surely formed on the support surface. It is preferred that the support surface have a dark color.
(10) According to a tenth feature of the present invention that includes any one of the fifth to ninth features (5) to (9), each of the lighting devices comprises at least one light emitting element.
Each lighting device may be one which employs a single light emitting element, or one which employs a plurality of light emitting elements. Each light emitting element may be a light emitting diode.
(11) According to an eleventh feature of the present invention that includes the tenth feature (10), the plurality of lighting devices comprise a number of light emitting elements which are substantially uniformly distributed on a surface and are divided into a plurality of areas each one of which comprises at least two light emitting elements and provides a corresponding one of the lighting devices.
(12) According to a twelfth feature of the present invention that includes the eleventh feature (11), the light emitting elements belonging to the each one of the areas are permanently unchangeable.
In this case, each one of the lighting devices can be easily selected, and a drive circuit associated with each light emitting element can be simplified.
(13) According to a thirteenth feature of the present invention that includes the eleventh feature (11), the light emitting elements belonging to the each one of the areas are changeable.
According to this feature, a group of light emitting elements belonging to each one of the lighting devices are temporary, and a portion (one, two, . . . , but not all) of the light emitting elements belonging to one lighting device may be replaced with a portion of the light emitting elements belonging to another lighting device. Thus, though each lighting device is provided by a plurality of light emitting elements, the direction in which the each lighting device lights the object can be finely changed.
(14) According to a fourteenth feature of the present invention that includes the fifth to thirteen features (5) to (13), the control device comprises a program memory which stores at least one lighting-and-image-taking controlling program to control the lighting devices and the image taking device; and a processor which implements the lighting-and-image-taking controlling program stored in the program memory.
(15) According to a fifteenth feature of the present invention that includes the fourteenth feature (14), the program memory stores a plurality of different lighting-and-image-taking controlling programs, and the control device further comprises a program selecting means for selecting one of the lighting-and-image-taking controlling programs stored in the program memory.
According to this feature, the directions in which the object is lighted and/or the number of image taking operations can be easily changed depending upon a sort of object.
(16) According to a sixteenth feature of the present invention that includes the fourteenth or fifteenth feature (14) or (15), the image-data processing device comprises a plurality of image buffers each of which stores a corresponding one of the batches of image data representing the respective images taken by the image taking device; and a synthesizing means for synthesizing, based on the batches of image data stored in the image buffers, the respective images taken by the image taking device.